<?php
if ($type == 'class') {
    $ClassBatch = 'ClassBatch';
} else {
    $ClassBatch = 'CourseBatche';
}
?>
<div class="classStructureControl">
    <div class="rowLabel"><?php echo $form->labelEx($model, 'start_time'); ?> </div>
    <div class="rowLabel"><?php echo $form->labelEx($model, 'end_time'); ?> </div>
    <div class="rowLabel"><?php echo $form->labelEx($model, 'description'); ?> </div>
    <div class="rowLabel">&nbsp;</div>
</div>
<div style="clear:both;"></div>
<div id="addclassStructuresappend_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>">
    <?php if ($modelClassCourse->id && count($allCourseStructure) > 0) { ?>
        <?php for ($i = 0; $i < count($allCourseStructure); $i++) { ?>  
            <?php $model = $this->loadModel($allCourseStructure[$i]->id, 'ClassStructures'); ?>
            <div style="clear:both;"></div>
            <div class="classStructureControl" <?php if ($i > 0): ?>id="remove_classStructures_<?php echo $i; ?>_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>"<?php endif; ?>>
                <div class="rowControl input-append"><?php echo $form->textField($model, $ClassBatch . '[' . $batcheIndex . '][ClassVenue][' . $venueIndex . '][start_time][]', array('class' => 'input-medium', 'id' => 'ClassStructures_start_time_' . $i . '_venue_' . $venueIndex . '_batch_' . $batcheIndex, 'value' => $model->start_time, 'onkeypress' => 'return isNumberKey(event)', 'maxlength' => '3', 'readonly' => 'readonly')); ?><span class="add-on">Min</span>
                    <?php echo $form->error($model, 'start_time'); ?>
                </div>
                <div class="rowControl input-append"><?php echo $form->textField($model, $ClassBatch . '[' . $batcheIndex . '][ClassVenue][' . $venueIndex . '][end_time][]', array('class' => 'input-medium', 'id' => 'ClassStructures_end_time_' . $i . '_venue_' . $venueIndex . '_batch_' . $batcheIndex, 'value' => $model->end_time, 'onkeypress' => 'return isNumberKey(event)', 'maxlength' => '3')); ?><span class="add-on">Min</span>
                    <?php echo $form->error($model, 'end_time'); ?>
                </div>
                <div class="rowControl" style="width: 33%;"><?php echo $form->textField($model, $ClassBatch . '[' . $batcheIndex . '][ClassVenue][' . $venueIndex . '][description][]', array('class' => 'input-xlarge', 'id' => 'ClassStructures_description_' . $i . '_venue_' . $venueIndex . '_batch_' . $batcheIndex, 'value' => $model->description)); ?>
                    <?php echo $form->error($model, 'description'); ?>
                </div>
                <input type="hidden" name="addclassStructure" id="addclassStructurecount_<?php echo $i; ?>_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>"  class="startDatecount_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>" value="<?php echo $i; ?>">
                <?php if ($i > 0): ?>
                    <div style="margin-top: 10px; margin-left: 8px; width:15%;" class="rowControl">
                        <a onclick="removeclassStructures(this.id);" id="classStructures_<?php echo $i; ?>_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>" class="link-remove revclassStructures_<?php echo $i; ?>" href="javascript:void(0)">Remove</a>
                    </div>
                <?php endif; ?>
            </div>	
        <?php } ?>
    <?php } else { ?>	

        <div class="classStructureControl" >
            <div class="rowControl input-append">
                <input  name="ClassStructures[<?php echo $ClassBatch; ?>][<?php echo $batcheIndex; ?>][ClassVenue][<?php echo $venueIndex; ?>][start_time][]" id="ClassStructures_start_time_0_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>" type="text" class="input-medium " onkeypress="return isNumberKey(event)"  placeholder="0"  maxlength="3" value="0" readonly="readonly"><span class="add-on">Min</span>
                <?php echo $form->error($model, 'start_time'); ?>
            </div>
            <div class="rowControl input-append">
                <input  name="ClassStructures[<?php echo $ClassBatch; ?>][<?php echo $batcheIndex; ?>][ClassVenue][<?php echo $venueIndex; ?>][end_time][]" id="ClassStructures_end_time_0_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>" type="text" class="input-medium" onblur="addValueInclassStructureStartTime(this.id)" maxlength="2" onkeypress="return isNumberKey(event)"><span class="add-on">Min</span>
                <?php echo $form->error($model, 'end_time'); ?>
            </div>
            <input type="hidden" name="addclassStructure" id="addclassStructurecount_0_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>" value="0" class="startDatecount_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>">
            <div class="rowControl" style="width: 32%;"><input type="text"  name="ClassStructures[<?php echo $ClassBatch; ?>][<?php echo $batcheIndex; ?>][ClassVenue][<?php echo $venueIndex; ?>][description][]" id="ClassStructures_description_0_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>" class="input-xlarge">
                <?php echo $form->error($model, 'description'); ?>
            </div>


        </div>

        <?php
        $i = 1;
    }
    ?>	
</div>

<div class="rowControl clear"><a href="javascript:void(0)" class="link-buttonadd classStructures_add_venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>" id="venue_<?php echo $venueIndex; ?>_batch_<?php echo $batcheIndex; ?>_addclass_structures_<?php echo $i - 1; ?>" onclick="addclassStructures(this.id);">Add Structures</a></div>